﻿using System;
using System.Data;
using System.Web.UI;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

namespace ContractManagementSystem.Presentation.ReportManagement
{
    public partial class ShowReportContractor1 : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["SOURCE_CONTRACTOR_TABLE"] != null)
            {
                var reportDocument = new ReportDocument();

                reportDocument.Load(Server.MapPath("CrystalReportContractor.rpt"));

                var dataTable = (DataTable) Session["SOURCE_CONTRACTOR_TABLE"];
                reportDocument.SetDataSource(dataTable);

                CrystalReportViewerContractor.DisplayGroupTree = false;
                CrystalReportViewerContractor.ReportSource = reportDocument;
                CrystalReportViewerContractor.DataBind();
                CrystalReportViewerContractor.RefreshReport();
            }
        }
    }
}